<template>
  <div>
      <div>
        姓名 <input v-model="name"/>
      </div>
      <div>
        年龄 <input v-model="age"/>
      </div>
      <button @click="add">新增</button>
  </div>
</template>

<script>
export default {
  data(){
    return  {
      name:"",
      age:""
    }
  },
  methods:{
    add(){
     // alert(this.name+"和"+this.age);
      this.$emit("addListItem",{
        name:this.name,
        age:this.age
      })

    }

  }

}
</script>

<style>

</style>